package com.suncaper.shop.service;

import com.suncaper.shop.domain.Category;
import com.suncaper.shop.domain.CategoryExample;
import com.suncaper.shop.mapper.CategoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CategoryService {

    @Autowired
    private CategoryMapper categoryMapper;

    private CategoryExample categoryExample;


    public List<Category> findAllCategory() {
        categoryExample = new CategoryExample();
        return categoryMapper.selectByExample(categoryExample);
    }

    public List<Category> findCategory(Integer from, Integer to) {

        categoryExample = new CategoryExample();
        categoryExample.createCriteria().andCidBetween(from, to);
        return categoryMapper.selectByExample(categoryExample);
    }
}
